import sqlite3

import pymysql


def get_db_connect():
    connection = pymysql.connect(
        host='localhost',  # 127.0.0.1
        port=3306,
        user='root',
        passwd='123456',
        db='xsxx',
        cursorclass=pymysql.cursors.DictCursor
    )
    if connection.open:
        print("连接成功")
    return connection

if __name__ == '__main__':
    connection = get_db_connect()